<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>前端路由的基石_history</title>
  <script type="text/javascript" src="https://cdn.bootcss.com/history/4.7.2/history.js"></script>
</head>
<body>
	<button onclick="demo('/home')">主页</button>
	<button onclick="demo('/hot')">热门</button>
	<button onclick="demo('/mine')">我的</button>

	<script type="text/javascript">
	const h = History.createBrowserHistory() 

	function demo(path){
		h.replace(path)
	}

	h.listen((a)=>{
		console.log(a)
	})
		
	</script>
</body>
</html>